I do not have a lot of dxl experience. I'm trying to generate a view within a requirements module that will pull CPS CP "Proposed attribute" values. I would like those "Proposed attribute" values to contain indicators as to the type of modification being made. A strike-through for proposed deletions and underlines for proposed additions. Does anyone know if there is a script anywhere that would perform these types of markups that I could apply either to the CP module or the requirements module dxl column. |
Re: DXL script to display CPS "Proposed" attributes with redline markups Show CPS Proposed changes in Layout DXL |
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Fri Jun 05 03:06:08 EDT 2009 Thank you so much for your help. I applied the script and it displays the difference between the object text and the proposed object text in redline markups. The next problem I've encountered it that I have other attributes besides the object text that I would like to be able to see those "proposed" changes as well. I think I mentioned that I am pretty dxl illiterate, but I thought I might be able to modify the script to include additional redline differences for all of the attributes configured in my CP module ... I was wrong. I have attached the file, I'm not sure if it will work because when I try to check it in the Edit Layout DXL window I get a syntex error. Help ! What am I doing wrong? Attachments attachment_14265530_Proposed_Changes_dxl.txt |
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Fri Jun 05 03:06:08 EDT 2009 bla bla bla, I thought the diff function would fail when it was comparing text that contained actual rich-text markup as part of the actual text. I thought "This \\ul \strike is text" would not diff correctly with "This \ul more text \\strike is \\ul text". But I guess it does so long as the results are going to an attr or to a DBE. Try sending that to Word. Anyway, your code should check to make sure the CP in question is indeed a CP, and it should also check to make sure that Object Text is being proposed to change. You need to check that both of these CP attributes have value "True": "CP Attr - Proposal" and "Using Object Text". You also would want to make sure it isn't a closed CP, no sense displaying the difference for a Rejected CP. Make sure "CP Attr - Status" isn't "Applied" nor "Rejected". You also may not want to display the differences when the CP is an Insert; or better yet only show the difference when its a Modification CP. Make sure "CP Attr - Change Type" is "Modification". Perhaps if its a "Deletion" CP you want to display completely strike-out text; diff it with null string.
|
Re: DXL script to display CPS "Proposed" attributes with redline markups SystemAdmin - Mon Jun 22 14:04:52 EDT 2009 Add the closing brace } after the line containing delete buff1. These syntax errors can be hard to find because the interpreter gets confused and the line numbers reported are not always what you might expect. |
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Tue Jun 23 03:06:27 EDT 2009
A better approach would be to put the attribute names in a strign aray and iterate through them. Louie's advice is also good, but this should get you started for now.
// Proposed Changes
/*
Layput DXL to display redlined differences between Object Text and
proposed object text.
Tony Goodman
*/
pragma runLim,0
string shortName = "Change Proposal Links"
string ATTRS[] = { "Object Text", "HW MOD" }
Link l
LinkRef lr
string otherModName
Module linkMod = null
Object othero
Object po
string orderString = ""
User usr
string s = ""
int i = 0
Buffer a = create()
Buffer b = create()
Buffer buff1 = create()
Buffer buff2 = create()
for lr in obj<-"*" do
{
otherModName = fullName(source lr)
if (!module otherModName) continue
if (isDeleted module otherModName) continue
if (!open module otherModName) read(otherModName,false)
}
for l in obj<-"*" do
{
linkMod = module(l)
if (null linkMod) continue
if (name(linkMod) != shortName) continue
othero = source l
if (null othero) continue
if (isDeleted othero) continue
for (i = 0; i < sizeof(ATTRS); i++)
{
setempty(a)
setempty(b)
a = probeAttr_(obj, attr)
b = probeAttr_(othero, "Proposed " attr)
if ( length(a) > 10000 || length(b) > 10000 )
{
displayRich "{\\i (Text too big to compare.)}"
} else
{
Buffer buff1 = create
diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ")
s = identifier(othero)
buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n"
displayRichWithColour (attr ": " tempStringOf buff1)
delete buff1
}
}
}
delete(a)
delete(b)
|
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Tue Jun 23 03:41:57 EDT 2009
A better approach would be to put the attribute names in a strign aray and iterate through them. Louie's advice is also good, but this should get you started for now.
// Proposed Changes
/*
Layput DXL to display redlined differences between Object Text and
proposed object text.
Tony Goodman
*/
pragma runLim,0
string shortName = "Change Proposal Links"
string ATTRS[] = { "Object Text", "HW MOD" }
Link l
LinkRef lr
string otherModName
Module linkMod = null
Object othero
Object po
string orderString = ""
User usr
string s = ""
int i = 0
Buffer a = create()
Buffer b = create()
Buffer buff1 = create()
Buffer buff2 = create()
for lr in obj<-"*" do
{
otherModName = fullName(source lr)
if (!module otherModName) continue
if (isDeleted module otherModName) continue
if (!open module otherModName) read(otherModName,false)
}
for l in obj<-"*" do
{
linkMod = module(l)
if (null linkMod) continue
if (name(linkMod) != shortName) continue
othero = source l
if (null othero) continue
if (isDeleted othero) continue
for (i = 0; i < sizeof(ATTRS); i++)
{
setempty(a)
setempty(b)
a = probeAttr_(obj, attr)
b = probeAttr_(othero, "Proposed " attr)
if ( length(a) > 10000 || length(b) > 10000 )
{
displayRich "{\\i (Text too big to compare.)}"
} else
{
Buffer buff1 = create
diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ")
s = identifier(othero)
buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n"
displayRichWithColour (attr ": " tempStringOf buff1)
delete buff1
}
}
}
delete(a)
delete(b)
I tweaked it to take the exact output and set an attribute value. While the strike-outs and underscores are displayed, the color is not. I see no such 'set attr with color' command. I see there is a color table in the output. Got any ideas? >Louie |
Re: DXL script to display CPS "Proposed" attributes with redline markups llandale - Wed Jun 24 12:59:47 EDT 2009 I got the layout working and it displays fine. I then converted to attribute DXL. Had to manually add overloaded function for displayRichWithColor. As you say, the strikethru and underline is shown but the colours are not. If I create another layout column and display the dxl attribute using displayRichWithColor(obj."DXL for cps") the colours are shown correctly. It seems that columns displaying attributes do not support color. I am stumped. |
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Thu Jun 25 02:49:47 EDT 2009 Here's the un-hosed layout DXL.
pragma runLim,0
string shortName = "Change Proposal Links"
string ATTRS[] = { "Object Text", "HW MOD" }
Link l
LinkRef lr
string otherModName
Module linkMod = null
Object othero
Object po
string orderString = ""
User usr
string s = ""
int i = 0
Buffer a = create()
Buffer b = create()
Buffer buff1 = create()
Buffer buff2 = create()
for lr in obj<-"*" do
{
otherModName = fullName(source lr)
if (!module otherModName) continue
if (isDeleted module otherModName) continue
if (!open module otherModName) read(otherModName,false)
}
for l in obj<-"*" do
{
linkMod = module(l)
if (null linkMod) continue
if (name(linkMod) != shortName) continue
othero = source l
if (null othero) continue
if (isDeleted othero) continue
for (i = 0; i < sizeof(ATTRS); i++)
{
setempty(a)
setempty(b)
a = probeAttr_(obj, ATTRS[i])
b = probeAttr_(othero, "Proposed " ATTRS[i])
if ( length(a) > 10000 || length(b) > 10000 )
{
displayRich "{\\i (Text too big to compare.)}"
} else
{
Buffer buff1 = create
diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ")
s = identifier(othero)
buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n"
displayRichWithColour (ATTRS[i] ": " tempStringOf buff1)
delete buff1
}
}
}
delete(a)
delete(b)
|
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Thu Jun 25 02:59:56 EDT 2009 Here's the un-hosed layout DXL.
pragma runLim,0
string shortName = "Change Proposal Links"
string ATTRS[] = { "Object Text", "HW MOD" }
Link l
LinkRef lr
string otherModName
Module linkMod = null
Object othero
Object po
string orderString = ""
User usr
string s = ""
int i = 0
Buffer a = create()
Buffer b = create()
Buffer buff1 = create()
Buffer buff2 = create()
for lr in obj<-"*" do
{
otherModName = fullName(source lr)
if (!module otherModName) continue
if (isDeleted module otherModName) continue
if (!open module otherModName) read(otherModName,false)
}
for l in obj<-"*" do
{
linkMod = module(l)
if (null linkMod) continue
if (name(linkMod) != shortName) continue
othero = source l
if (null othero) continue
if (isDeleted othero) continue
for (i = 0; i < sizeof(ATTRS); i++)
{
setempty(a)
setempty(b)
a = probeAttr_(obj, ATTRS[i])
b = probeAttr_(othero, "Proposed " ATTRS[i])
if ( length(a) > 10000 || length(b) > 10000 )
{
displayRich "{\\i (Text too big to compare.)}"
} else
{
Buffer buff1 = create
diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ")
s = identifier(othero)
buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n"
displayRichWithColour (ATTRS[i] ": " tempStringOf buff1)
delete buff1
}
}
}
delete(a)
delete(b)
Method to make this work: displayRichWithColor(obj,"DXL for CPS") |
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Thu Jun 25 03:26:13 EDT 2009
Method to make this work: displayRichWithColor(obj,"DXL for CPS") |
Re: DXL script to display CPS "Proposed" attributes with redline markups Tony_Goodman - Thu Jun 25 03:26:13 EDT 2009
Method to make this work: displayRichWithColor(obj,"DXL for CPS") -E- DXL: <Line:96> incorrect arguments for function (displayRichWithColour) -I- DXL: all done with 1 error and 0 warnings I know I'm doing something wrong, I just don't know what. See attached script. Also, I would like to not display CPs that have been statused as Applied or Rejected. Which means going back to the original script, putting in a condition statement but my attempts at that have failed as well. All help is appreciated. Attachments attachment_14270389_attribute_DXL_for_CPS.txt |